const { JmxExecutor, JmxRuntime, JmxScheduler } = require("../../src/jmxExecution");

const jmeterHomePath = "D:\\Development\\jmeter\\apache-jmeter-5.6.3";
const testPlans = [
    {
        testPlanName: "01.test",
        jmxFilePath: "C:\\Users\\毛建杰\\Desktop\\automated-performance-data\\jmx\\01.test.jmx",
        initialThreadNumber: 1,
        threadNumberIncrement: 2
    },
    {
        testPlanName: "02.test",
        jmxFilePath: "C:\\Users\\毛建杰\\Desktop\\automated-performance-data\\jmx\\02.test.jmx",
        initialThreadNumber: 2,
        threadNumberIncrement: 3
    }
];
const jtlPath = "C:\\Users\\毛建杰\\Desktop\\automated-performance-data\\jtl";

(async function () {
    const jmxScheduler = new JmxScheduler(jmeterHomePath, testPlans, 10, jtlPath, 5);
    await jmxScheduler.schedule();
    if (jmxScheduler.testResults.length == 1) {
        console.log("------------瓶颈数据----------------");
        console.log(jmxScheduler.testResults[0]);
    }
    if (jmxScheduler.testResults.length > 1) {
        console.log("------------瓶颈数据----------------");
        console.log(jmxScheduler.testResults[jmxScheduler.testResults.length - 1]);
        console.log("------------最优数据----------------");
        console.log(jmxScheduler.testResults[jmxScheduler.testResults.length - 2]);
    }
})()